package com.softstao.guoyu.mvp.interactor.me;

import com.softstao.guoyu.global.APIInterface;
import com.softstao.guoyu.model.me.MeToOtherList;
import com.softstao.guoyu.model.me.OtherToMeList;
import com.softstao.guoyu.model.me.ProvinceRebate;
import com.softstao.guoyu.model.me.RebateCondition;
import com.softstao.guoyu.model.me.RebateDetail;
import com.softstao.guoyu.mvp.interactor.BaseInteractor;
import com.softstao.guoyu.utils.MyHttpParams;

import rx.functions.Action1;

/**
 * Created by vaikus on 2017/7/20.
 */

public class RebateInteractor extends BaseInteractor {
    public void getProvinceRebate(int agentId,String month,Action1<Object> action1){
        MyHttpParams params = new MyHttpParams("agentId",agentId,"month",month);
        builder.setAction(action1)
                .setUrl(APIInterface.PROVINCE_REBATE)
                .setType(ProvinceRebate.class)
                .getVolley()
                .post(params);
    }

    public void getOtherToMeList(int page,int agentId,String month,Action1<Object> action1){
        MyHttpParams params = new MyHttpParams("agentId",agentId,"month",month,"pageSize","8","pageIndex",page);
        builder.setAction(action1)
                .setUrl(APIInterface.OTHER_TO_ME_LIST)
                .setType(OtherToMeList.class)
                .getVolley()
                .post(params);
    }

    public void getMeToOtherList(int page,int agentId,String month,Action1<Object> action1){
        MyHttpParams params = new MyHttpParams("agentId",agentId,"month",month,"pageSize","8","pageIndex",page);
        builder.setAction(action1)
                .setUrl(APIInterface.ME_TO_OTHER_LIST)
                .setType(MeToOtherList.class)
                .getVolley()
                .post(params);
    }

    public void  getOtherToMeDetail(int page, RebateCondition condition,Action1<Object> action1){
        MyHttpParams params = new MyHttpParams(condition);
        params.put("pageSize","8");
        params.put("pageIndex",page);
        builder.setAction(action1)
                .setUrl(APIInterface.OTHER_TO_ME_DETAIL)
                .setType(RebateDetail.class)
                .getVolley()
                .post(params);
    }

    public void  getMeToOtherDetail(int page, RebateCondition condition,Action1<Object> action1){
        MyHttpParams params = new MyHttpParams(condition);
        params.put("pageSize","8");
        params.put("pageIndex",page);
        builder.setAction(action1)
                .setUrl(APIInterface.ME_TO_OTHER_DETAIL)
                .setType(RebateDetail.class)
                .getVolley()
                .post(params);
    }
}
